/** 
    @file game.hpp
    @brief The main game class
*/

#ifndef PM3_GAME_HPP
#define PM3_GAME_HPP

#include "interface.hpp"
#include "physics.hpp"
#include "pixel/pixelworld.hpp"
#include "pixel/pixelmail.hpp"
#include "input/frame_listener.hpp"
#include "hud/text_overlay.hpp"

//! Pixelmaze functionality
namespace pm3 {

    /**
        @class GAME
        @brief The main singleton
    */
    class GAME: public Ogre::Singleton<GAME> {
    public:
            /**
                @brief Constructor
            */
            GAME();
            /**
                @brief Destructor
            */
            ~GAME();

            /**
                @brief Starts the game
            */
		    void go();

    private:
            //! Ogre viewport pointer
            Ogre::Viewport *m_viewport;

            //! Pointer to the frame listener
		    FRAME_LISTENER *m_frame_listener;

            //! Text overlay for debugging output
            hud::TEXT_OVERLAY *m_text_overlay;

            //! Are we rendering with OpenGL?
            bool m_is_opengl;
            //! The shadow technique we're using
            Ogre::ShadowTechnique m_shadow_tech;

            /**
                @brief Initializes all singletons (log, mailbox, interface, world)
            */
            void init();

            /**
                @brief Configures Ogre
            */
		    void config();
            /**
                @brief Sets up listeners
            */
		    void setup_listeners();
            /**
                @brief Sets up shadow rendering
            */
            void setup_shadows();
            /**
                @brief Cleans up and deletes the Ogre root node along with everything else
            */
            void cleanup();
    };

}

#endif

